package cn.wolfcode.wolf2w.controller;

import cn.wolfcode.wolf2w.annotation.LoginPermissions;
import cn.wolfcode.wolf2w.domain.Banner;
import cn.wolfcode.wolf2w.domain.Travel;
import cn.wolfcode.wolf2w.domain.UserInfo;
import cn.wolfcode.wolf2w.redis.service.IStrategyStatisVORedisService;
import cn.wolfcode.wolf2w.redis.service.ITravelStatisVORedisService;
import cn.wolfcode.wolf2w.redis.service.IUserInfoRedisService;
import cn.wolfcode.wolf2w.service.IBannerService;
import cn.wolfcode.wolf2w.service.IUserInfoService;
import cn.wolfcode.wolf2w.util.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;

@RestController
@RequestMapping("/index")
public class IndexController {
    @Autowired
    private IBannerService bannerService;

    /**
     * 查询当前在banner中排名前五的游记
     * @return
     */
    @RequestMapping("/banners/travel")
    public Object travel(){
        List<Banner> bannerTravels = bannerService.findTravelByType();
        return JsonResult.success(bannerTravels);
    }

    /**
     * 查询当前banner中排名第一的攻略
     * @return
     */
    @RequestMapping("/banners/strategy")
    public Object strategy(){
        List<Banner> bannerTravels = bannerService.findStrategyByType();
        return JsonResult.success(bannerTravels.get(0));
    }
}
